package commander;

import repository.Repository;

import java.io.File;
import java.util.Scanner;
//建立Command类
public class Command {
    protected String path;
    protected String workingDir;//工作区
    protected File index;//暂存区
    protected File head;//头指针
    public Command(){
        workingDir = Repository.getWorkTree() + File.separator;
        //此处Repository.getGitDir()未定义，System.getProperty("user.dir")
        path = workingDir + ".jit" + File.separator;
        //Repository.getGitDir()/.git
        index = new File(path + "index");
        head = new File(path + "HEAD");
        System.out.println("Working Directory : " + workingDir);
    }
    protected String wrapGit(String s){
        return path + File.separator + s;
    }
    //连接Repository仓库，wrapGit("refs/heads")表示储存branch的文件夹
    protected String wrapObjects(String s){
        return path + File.separator + "objects" + File.separator + s;
    }
    // gitObjects路径为 Repository.getGitDir() + File.separator + "objects";
    public String getPath(){
        return path;
    }
    public String getWorkingDir(){
        return workingDir;
    }

 /*   public static void main(String[] args){
        try{
            System.out.println(new Command().path);
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }*/
}